package org.potiorb.orb.marshal;

import org.potiorb.orb.giop.GIOPMessageRequest;
import org.potiorb.orb.giop.GIOPMessageRequestReflexive;
import org.potiorb.orb.giop.MessageType;
import org.potiorb.orb.portable.ObjectRef;

public class MarshalerReflexive extends Marshaler {
	
	
	public GIOPMessageRequestReflexive MarshalInvocationRequest(ObjectRef pObjectRef,
			  CallData calldata, Any[] data){
				
		
		GIOPMessageRequestReflexive msg = new GIOPMessageRequestReflexive();
		msg.setM_MessageType( new MessageType(MessageType.REQUEST));
		byte[] context = {0x00,0x00,0x00,0x00};
		msg.setService_context(context);
		msg.setRequestID(1);
		msg.setResponse_expected(true);
		String key = pObjectRef.getKeyobject();
		msg.setObject_key(key);
		msg.setOperation(calldata.getMethodName());
		msg.setFirstMethod(data[0].extract_string());
		msg.setSecondMethod(data[1].extract_string());
		msg.setObjectReferenceFirst(data[2].extract_string());
		msg.setObjectReferenceSecond(data[3].extract_string());
		msg.setFirstMethodParams(data[4].extract_array());
		msg.setSecondMethodParams(data[5].extract_array());
		
		return msg;
		
	}

}
